package com.nlx.notes.module.mapper;

import com.nlx.notes.module.bean.bo.CategoryMonthStatisticsBo;
import com.nlx.notes.module.bean.bo.FlowMonthAmountStatisticsBO;
import com.nlx.notes.module.bean.bo.TransactionsBO;
import com.nlx.notes.module.bean.dto.FlowPageQueryDTO;
import com.nlx.notes.module.bean.dto.TransactionsQueryDTO;
import com.nlx.notes.module.bean.dto.statistics.TopStatisticsDBQueryDTO;
import com.nlx.notes.module.bean.vo.flow.FlowStatisticsSumVO;
import com.nlx.notes.module.entity.Transactions;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author nlx
 * @since 2024-12-15
 */
public interface TransactionsMapper extends BaseMapper<Transactions> {

    List<Transactions> pageByCondition(FlowPageQueryDTO flowPageQueryDTO);

    long countByCondition(FlowPageQueryDTO flowPageQueryDTO);

    int findAmountByCondition(FlowPageQueryDTO flowPageQueryDTO);

    FlowStatisticsSumVO sumByDay(@Param("flowDate") LocalDate flowDate, @Param("userId") Long userId);

    List<CategoryMonthStatisticsBo> findCategoryStatistics(@Param("startDate") String startDate,
                                                           @Param("endDate") String endDate,
                                                           @Param("userId") Long userId, @Param("bookId") Long bookId);

    FlowMonthAmountStatisticsBO sumByDate(@Param("startDate") String starDate,
                                          @Param("endDate") String endDate,
                                          @Param("userId") Long userId,
                                          @Param("bookId") Long bookId);

    List<Transactions> findListByCondition(TransactionsQueryDTO transactionsQueryDTO);

    List<TransactionsBO> findTop(TopStatisticsDBQueryDTO topStatisticsDBQueryDTO);
}